﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [steve].[spSteve_InsertSiteUrl] 
	-- Add the parameters for the stored procedure here
	@SiteUrlId uniqueidentifier,
	@SiteName varchar(50),
	@SystemName varchar(50),
	@ExternalId varchar(50),
	@Url varchar(800),
	@StartDate datetime2(7),
	@EndDate datetime2(7),
	@IsSecure bit,
	@IgnoreQueryString bit, 
	@PageTitle nvarchar(200),
	@PageMetaDescription nvarchar(200),
	@PageMetaKeywords nvarchar(200),
	@RevisionDate datetime2(7),
	@RevisionMembershipId uniqueidentifier,
	@RevisionComment nvarchar(400)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	INSERT INTO SiteUrl (SiteUrlId
		, SiteName
		, SystemName
		, ExternalId
		, CreateDate
		, CreateMembershipId
		, LatestRevisionNumber
		, Url)
	VALUES (@SiteUrlId
		, @SiteName
		, @SystemName
		, @ExternalId
		, @RevisionDate
		, @RevisionMembershipId
		, 1
		, @Url)
		
	INSERT INTO SiteUrlRevision (SiteUrlId
		, RevisionNumber
		, StartDate
		, EndDate
		, IsSecure
		, IgnoreQueryString
		, PageTitle
		, PageMetaDescription
		, PageMetaKeywords
		, RevisionDate
		, RevisionMembershipId
		, RevisionComment)
	VALUES (@SiteUrlId
		, 1
		, @StartDate
		, @EndDate
		, @IsSecure
		, @IgnoreQueryString
		, @PageTitle
		, @PageMetaDescription
		, @PageMetaKeywords
		, @RevisionDate
		, @RevisionMembershipId
		, @RevisionComment)
		
	SELECT 1 as LatestRevisionNumber
		
END
